home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / FCENTER.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  51 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   FCENTER .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB01.INC"
  22. COLOR 7, 0
  23. CLS
  24.  
  25. ? "┌───────────────────────────────────────────────────────────────────────────
  26. ? "│ fCenterPos% ( Mini%, Maxi%  , ItemLen% )
  27. ? "│ fCenterBox% ( Mini%, BoxLen%, ItemLen% )
  28. ? "├───────────────────────────────────────────────────────────────────────────
  29. ? "│ There are 2 ways to compute the starting position to print a string, draw
  30. ? "│ a box, put an icon, etc. They both return the left/top most column/row but
  31. ? "│ work on different information. The one to use, obviously, is the one that
  32. ? "│ works with the info you've already got! :)
  33. ? "└───────────────────────────────────────────────────────────────────────────
  34.  
  35. D$ = "This is a test!"                        '│ something to print
  36. L% = LEN( D$ )                                '│ the length
  37. LOCATE 10, 21 : ? "┌"; STRING$(38,"─"); "┐"   '│ the "box"
  38. LOCATE 11, 21 : ? "│"; STRING$(38," "); "│"   '│ the hard way!
  39. LOCATE 12, 21 : ? "│"; STRING$(38," "); "│"   '│
  40. LOCATE 13, 21 : ? "│"; STRING$(38," "); "│"   '│
  41. LOCATE 14, 21 : ? "└"; STRING$(38,"─"); "┘"   '│
  42.                                               '│
  43. Col% = fCenterPos%( 21, 60, L% )              '│ 21 & 60 are the column #s
  44. LOCATE 11, Col% : PRINT D$                    '│
  45.                                               '│
  46. Col% = fCenterBox%( 21, 40, L% )              '│ 21 is the left most col
  47. LOCATE 12, Col% : PRINT D$                    '│ 40 is the len of the box
  48. Col% = fCenterPos%( 21, 40, L% )              '│ see the difference?
  49. LOCATE 13, Col% : PRINT D$                    '│
  50.  
  51.